// 仅SSR使用
export const useLocale = () => useState<string>('locale', () => useDefaultLocale().value);
const useDefaultLocale = (fallback = 'en') => {
    const locale = ref(fallback);
    const langQuery = useRoute().query?.['client-language'] || 'en';
    const lang = Array.isArray(langQuery) ? langQuery?.[0] || 'en' : langQuery;
    if (lang && ['en', 'ar', 'ur', 'tr', 'in', 'zh'].includes(lang)) {
        locale.value = lang;
    }
    return locale;
};
